Skip to content

Add async/await methods - #48

Open
Foriger wants to merge 2 commits into
mainfrom
concurrency
Open

Foriger wants to merge 2 commits into
mainfrom
concurrency

Conversation

@Foriger

@Foriger Foriger commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

}
}

/// Confirms user verification and as a result, an activation token is obtained. This activation token should be used in the registration process.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should -> must

}
}

/// Confirms user verification and as a result, an activation token is obtained. This activation token should be used in the registration process.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should -> must

}
}

/// Registers a new user for a given MIRACL Trust Project to the MIRACL Trust platform.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Project" doesn't need a capital letter, so it should be "MIRACL Trust project".

}
}

/// Gets ``CrossDeviceSession`` for a QR code.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gets the CrossDeviceSession for a QR code.


/// Gets ``CrossDeviceSession`` for a QR code.
/// - Parameter qrCode: a string read from the QR code.
/// - Returns: fetched ``CrossDeviceSession``

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns: the fetched CrossDeviceSession.

}
}

/// Gets ``CrossDeviceSession`` for a universal link.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gets the CrossDeviceSession for a universal link.

Comment thread README.md
)
// Handle session aborting result here.
} catch {
// Handle error

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle error.

Comment thread README.md
.abortCrossDeviceSession(
crossDeviceSession: crossDeviceSession
)
// Handle session aborting result here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle the session abort result here.

Comment thread README.md
)
// Get the QuickCode object or handle the error appropriately.
} catch {
// Handle error

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle error.

Comment thread README.md
let users = try await MIRACLTrust.getInstance().getUsers()
// Handle registered users.
} catch {
// Handle error

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle error.

Comment thread README.md
)
// Get the user object or handle the error appropriately.
} catch {
// Handle error

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle error.

} else if let error {
continuation.resume(throwing: error)
} else {
fatalError("\(#function) fatal error")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is SDK code, fatalError feels a bit too extreme since it will crash the host app. Could we throw a domain error via continuation instead?

let configuration = try Configuration.Builder(projectId: projectId, projectURL: projectURL).build()
try MIRACLTrust.configure(with: configuration)

MIRACLTrust.getInstance().crypto = createMockCrypto()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we mock userStorage here in init() so all tests automatically use a clean mock storage?

mockAPI.verificationResponse = VerificationRequestResponse(backoff: randomBackoff, method: method)
}

let crossDeviceSession = CrossDeviceSession(userId: UUID().uuidString, projectId: UUID().uuidString, sessionId: UUID().uuidString, sessionDescription: UUID().uuidString, signingHash: UUID().uuidString)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the createCrossDeviceSession() helper function here instead of instantiating CrossDeviceSession manually?

Comment thread README.md
method:

Swift:
<details open>

@NenoStefanov NenoStefanov Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is our main setup example, do we need the <details> wrapper here?

let platformAPI = PlatformAPIWrapper()

// swiftlint:disable:next function_body_length
@Test func compatibility() async throws {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we break this down into smaller test functions to make it easier to read and debug?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants